package com;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao.DBManipulation;

/**
 * Servlet implementation class EditCreditNoteServlet
 */
public class EditCreditNoteServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public EditCreditNoteServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		try
		{
		CreditNoteBean cdb = new CreditNoteBean();
		
		cdb.setSalesOrderNumber(request.getParameter("cdordernum")); 
		cdb.setInvoiceNumber(request.getParameter("cdinvoice")); 
		cdb.setDate(request.getParameter("cddate")); 
		cdb.setCustomerName(request.getParameter("customername")); 
		cdb.setCustomerCode(request.getParameter("customercode")); 
		cdb.setProductName(request.getParameter("stockname")); 
		cdb.setProductQuantity(Integer.parseInt(request.getParameter("cdproductquantity")));
		cdb.setProductRate(Double.parseDouble(request.getParameter("cdproductrate"))); 
		cdb.setNetAmount(Double.parseDouble(request.getParameter("cdnetamount"))); 
		cdb.setTaxationCategory(Double.parseDouble(request.getParameter("cdtaxcat"))); 
		cdb.setTaxAmount(Double.parseDouble(request.getParameter("cdtaxamount"))); 
		cdb.setTransportCharges(Double.parseDouble(request.getParameter("cdtransport"))); 
		cdb.setTotalAmount(Double.parseDouble(request.getParameter("cdtotalamount"))); 
		cdb.setCreditLimit(Integer.parseInt(request.getParameter("cdcredlimit"))); 
		cdb.setSalesRejectionReason(request.getParameter("cdrejectionreason")); 

		DBManipulation dbc= new DBManipulation();
		dbc.updateCreditNote(cdb);
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
